package com.brainydroid.example.numerical_distance;

import java.io.IOException;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.brainydroid.example.numerical_distance.ExampleNumDist;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;


public class Numerical_distance_experiment_Activity extends AndroidApplication {
    /** Called when the activity is first created. */

	ExampleNumDist end;
	
	   @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        
	        AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
	        cfg.useGL20 = false;
	          
	        
	        Bundle extras = getIntent().getExtras();
	        int exp_duration = extras.getInt("duration");
			 
		//	Toast.makeText(Numerical_distance_experiment_Activity.this,
		//		Integer.toString(exp_duration), Toast.LENGTH_SHORT).show();

			System.out.println("exp_duration - recieved :"+ exp_duration);
			end = new ExampleNumDist(exp_duration);
	        initialize(end, cfg);
	       // onDestroy();
	        
	        
	    }
	   
	   public void start(){
		   
	   }
	   
	   @Override
	   public void onDestroy(){
		   try {
			end.end_of_exp();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		   super.onDestroy();
		   
		//	 Intent intent = new Intent();
		//	 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

//				intent.putExtra("Exit", true); // passing duration as an argument

	//		 intent.setClass(this, Post_experiment_Activity.class);
		//	 startActivity(intent);

	   }
}

